public function SubSectionIsPresent(subsection, section, iniDB) result(isHere)
return true if subsection is present in section, false otherwise
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
character(len=*),
|
intent(in) |
|
|
:: |
subsection |
|
character(len=*),
|
intent(in) |
|
|
:: |
section |
|
type(IniList),
|
intent(in) |
|
|
:: |
iniDB |
|
Return Value
logical
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
integer(kind=long),
|
public |
|
:: |
i |
|
|
|
integer(kind=long),
|
public |
|
:: |
j |
|
|
|
Source Code
FUNCTION SubSectionIsPresent &
!
(subsection, section, iniDB) &
!
RESULT (isHere)
IMPLICIT NONE
! subroutine arguments
! Scalar arguments with intent(in):
TYPE (IniList) , INTENT(IN) :: iniDB
CHARACTER (LEN = *), INTENT(IN) :: section
CHARACTER (LEN = *), INTENT(IN) :: subsection
! Local Scalars:
LOGICAL :: isHere
INTEGER (KIND = long) :: i,j
!------------end of declaration------------------------------------------------
isHere = .FALSE.
!search for section
DO i = 1, iniDB % nOfSections
IF (iniDB % sectionName (i) == section) THEN
EXIT !found section
ENDIF
ENDDO
!search for subsection in the section
DO j = 1, iniDB % nOfSubSections
IF (iniDB % subSectionName (j) == subsection) THEN
IF (iniDB % subSectionBegin (j) >= iniDB % sectionBegin (i) .AND. &
iniDB % subSectionEnd (j) <= iniDB % sectionEnd (i) ) THEN
isHere = .TRUE.
RETURN !found subsection
ELSE
CYCLE
ENDIF
ENDIF
ENDDO
RETURN
END FUNCTION SubSectionIsPresent